package com.mrd.frame.domain;

import java.util.Date;

/**
 * MRDPAY.ORDERS
 * @author dusy  2017-06-07
 * 订单表
 */
public class Order {
    /**
     * id
     */
    private String orderId;

    /**
     * 支付渠道 1微信；2支付宝；待续
     */
    private String payChannel;

    /**
     * 交易类型 1：支付，2：退款
     */
    private String tradeType;

    /**
     * 商户在支付平台的帐号
     */
    private String userKey;

    /**
     * 商户订单号（支付为支付单号，退款为退款单号）
     */
    private String tradeNo;

    /**
     * 关联的商户订单号（退款时，对应的支付单号）
     */
    private String relatedTradeNo;

    /**
     * 请求发起时间
     */
    private Date timeStart;

    /**
     * 订单状态  0：处理失败，1：进行中，2：完成，3：超时，4：验证不通过或重复请求
     */
    private String status;

    /**
     * 支付为支付金额，退款为退款金额
     */
    private Integer totalAmount;

    /**
     * 二维码图片存放地址（全路径）
     */
    private String qrUrl;

    /**
     * 第三方单号
     */
    private String thirdOrderId;

    /**
     * 支付方式 NATIVE：原生扫码支付
     */
    private String payType;

    public String getOrderId() {
        return orderId;
    }

    public void setOrderId(String orderId) {
        this.orderId = orderId == null ? null : orderId.trim();
    }

    public String getPayChannel() {
        return payChannel;
    }

    public void setPayChannel(String payChannel) {
        this.payChannel = payChannel == null ? null : payChannel.trim();
    }

    public String getTradeType() {
        return tradeType;
    }

    public void setTradeType(String tradeType) {
        this.tradeType = tradeType == null ? null : tradeType.trim();
    }

    public String getUserKey() {
        return userKey;
    }

    public void setUserKey(String userKey) {
        this.userKey = userKey == null ? null : userKey.trim();
    }

    public String getTradeNo() {
        return tradeNo;
    }

    public void setTradeNo(String tradeNo) {
        this.tradeNo = tradeNo == null ? null : tradeNo.trim();
    }

    public String getRelatedTradeNo() {
        return relatedTradeNo;
    }

    public void setRelatedTradeNo(String relatedTradeNo) {
        this.relatedTradeNo = relatedTradeNo == null ? null : relatedTradeNo.trim();
    }

    public Date getTimeStart() {
        return timeStart;
    }

    public void setTimeStart(Date timeStart) {
        this.timeStart = timeStart;
    }

    public String getStatus() {
        return status;
    }

    public void setStatus(String status) {
        this.status = status == null ? null : status.trim();
    }

    public Integer getTotalAmount() {
        return totalAmount;
    }

    public void setTotalAmount(Integer totalAmount) {
        this.totalAmount = totalAmount;
    }

    public String getQrUrl() {
        return qrUrl;
    }

    public void setQrUrl(String qrUrl) {
        this.qrUrl = qrUrl == null ? null : qrUrl.trim();
    }

    public String getThirdOrderId() {
        return thirdOrderId;
    }

    public void setThirdOrderId(String thirdOrderId) {
        this.thirdOrderId = thirdOrderId == null ? null : thirdOrderId.trim();
    }

    public String getPayType() {
        return payType;
    }

    public void setPayType(String payType) {
        this.payType = payType == null ? null : payType.trim();
    }

	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + ((payChannel == null) ? 0 : payChannel.hashCode());
		result = prime * result + ((payType == null) ? 0 : payType.hashCode());
		result = prime * result + ((relatedTradeNo == null) ? 0 : relatedTradeNo.hashCode());
		result = prime * result + ((totalAmount == null) ? 0 : totalAmount.hashCode());
		result = prime * result + ((tradeNo == null) ? 0 : tradeNo.hashCode());
		result = prime * result + ((tradeType == null) ? 0 : tradeType.hashCode());
		result = prime * result + ((userKey == null) ? 0 : userKey.hashCode());
		return result;
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		Order other = (Order) obj;
		if (payChannel == null) {
			if (other.payChannel != null)
				return false;
		} else if (!payChannel.equals(other.payChannel))
			return false;
		if (payType == null) {
			if (other.payType != null)
				return false;
		} else if (!payType.equals(other.payType))
			return false;
		if (relatedTradeNo == null) {
			if (other.relatedTradeNo != null)
				return false;
		} else if (!relatedTradeNo.equals(other.relatedTradeNo))
			return false;
		if (totalAmount == null) {
			if (other.totalAmount != null)
				return false;
		} else if (!totalAmount.equals(other.totalAmount))
			return false;
		if (tradeNo == null) {
			if (other.tradeNo != null)
				return false;
		} else if (!tradeNo.equals(other.tradeNo))
			return false;
		if (tradeType == null) {
			if (other.tradeType != null)
				return false;
		} else if (!tradeType.equals(other.tradeType))
			return false;
		if (userKey == null) {
			if (other.userKey != null)
				return false;
		} else if (!userKey.equals(other.userKey))
			return false;
		return true;
	}
}